package net.etfbl.projekat.verko.bean;

import java.io.Serializable;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;

import net.etfbl.projekat.verko.dao.DataManager;
import net.etfbl.projekat.verko.dto.Korisnik;

@ManagedBean(name="korisnik")
@RequestScoped

public class KorisnikBean implements Serializable{
	
	/**
	 * 
	 */
	private static final long serialVersionUID = 3929104043915251800L;
	
	private String username;
	private String password;
	private DataManager dateMenager=new DataManager();
	public String getUsername() {
		return username;
	}
	public void setUsername(String username) {
		this.username = username;
	}
	public String getPassword() {
		return password;
	}
	public void setPassword(String password) {
		this.password = password;
	}
	private Korisnik userLogin=new Korisnik();
	public String login(){
		int rez=0;
		
		rez=dateMenager.login(userLogin);
		
		
		if(rez==1){
			return "registrovan";
		}
		else if(rez==2)
		{
			return "admin";
		}
		else if(rez==3){
			return "neaktivan";
		}
		else return "neregistrovan";
		
	}

}
